Evaluating the biodiversity changes (BIOSAFE)

Overview

This notebook facilitates using the RiverScape Python package to evaluate the effects of RiverScape measures on biodivesity using the BIOSAFE model. If this is your first time running the notebook, we advise you to read its reference paper (Straatsma et al., 2017, including its supplementary material).

In [1]:
# to display all output from a cell
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
# see: https://ipython.readthedocs.io/en/stable/config/options/terminal.html#configtrait-InteractiveShell.ast_node_interactivity

Requirement (Python modules/packages)

To run this notebook, please import the following Python modules.

In [2]:
# import standard modules
import os
import shutil
import sys
import string
import subprocess
import time
import math
import pprint as pp

# import required modules/packages (which may require installation)
import numpy as np
import pandas as pd
import geopandas as gpd
import seaborn as sns

import matplotlib.pyplot as plt

import pcraster as pcr

Please also make sure that this notebook file is in the same folder as the RiverScape Python module files that must be loaded. You can then import the RiverScape Python module by running the following cell.

In [3]:
from riverscape import *
import geoviews
geoviews.extension('bokeh')

Input folder

The input folder is given in the following location.

In [4]:
# set the current directory as the root directory
try:
    if root_dir == None: root_dir = os.getcwd()
except:
    root_dir = os.getcwd()

# by default, the input folder is given in the following location that is relative to the root directory (the current directory)
github_input_dir_source = "../input_files/input/bio/"
input_dir_source = os.path.join(root_dir, github_input_dir_source)

You may also want to set the input folder, interactively, by running the following cells.

In [5]:
# go to the above suggested 'input_dir_source'
os.chdir(input_dir_source); input_dir_source = os.getcwd()

# open an interactive window
get_input_dir_source = ""
# get_input_dir_source = select_directory()
# - if cancel or not used, we use the above suggested 'input_dir_source'
if get_input_dir_source == "" or get_input_dir_source == "()": get_input_dir_source = input_dir_source

input_dir_source = get_input_dir_source
In [6]:
msg = "The input folder is set on   : {}".format(input_dir_source)
print(msg)

# return to the root folder for further processes.
os.chdir(root_dir)
The input folder is set on   : /nfs/home4/edwinhs/github/edwinkost/RiverScape/input_files/input/bio

Output folder

Please set your output folder. Please adjust if necessary.

In [7]:
output_folder = "/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/"

You can also set the output folder, interactively, by running the following cells.

In [8]:
# open an interactive window
get_output_folder = ""
# get_output_folder = select_directory()
# - if cancel or not used, we use the above defined 'output_folder'
if get_output_folder == () or get_output_folder == "": get_output_folder = output_folder

output_folder = get_output_folder
In [9]:
msg = "The output folder is set on   : {}".format(output_folder)
print(msg)
The output folder is set on   : /scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/

The files in the input folder will be copied to the output folder. The output folder will also be set as the working directory. All plots would be saved in this directory.

In [10]:
# safe copying method 
source = os.listdir(input_dir_source)
destination = output_folder
for files in source:
    shutil.copy(os.path.join(input_dir_source, files), destination)

#~ # dangerous copying method 
#~ if os.path.exists(output_folder): shutil.rmtree(output_folder)
#~ shutil.copytree(input_dir_source, input_dir_source)
    
# use the output folder as the working directory
os.chdir(output_folder)
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/eco_conversion.csv'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/flpl_sections.map.ovr'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/flpl_sections.map.vat.cpg'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/ecotopes_msr.map'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/ecotopes.map'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/lut_ttp2eco.csv'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/linksLaw.csv'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/flpl_sections.map.vat.dbf'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/BIOSAFE_20150629.xlsx'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/legalWeights.csv'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/lut_RWES.csv'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/sleutel.asc'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/legend_df.csv'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/ndff_sub_BS_13.pkl'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/flpl_sections.map.aux.xml'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/flpl_sections.map'
Out[10]:
'/scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/linksEco.csv'

Reading input files

To calculate biodiversity indices of protected and endangered species that are characteristic of the fluvial environment, this notebook applies the Spreadsheet Application For Evaluation of BIOdiversity (BIOSAFE) model (see e.g. de Nooij et al., 2003). The original spreadsheet file in an excel format is provided in the following location. We adopt the excel file to this notebook.

In [11]:
# the original excel file
excelFile = os.path.join(output_folder, 'BIOSAFE_20150629.xlsx')
msg = "The original excel file is given on {}".format(excelFile)
print(msg)
The original excel file is given on /scratch-shared/edwinhs/riverscape/biosafe_development/test_biosafe_5/BIOSAFE_20150629.xlsx

We adopt the spreadsheet/excel file to this notebook.

The first input to the spreadsheet is a matrix legalWeights (Legislative Weights) of user-specified weights for 16 different policy and legislative documents. The 16 legal documents considered are the most recent versions of: Dutch Red List species that are based on the criteria of the International Union for Conservation of Nature (IUCN), Dutch Flora and Fauna Act, EU Habitat Directive, EU Birds Directive, Bern Convention, and Bonn Convention. We assumed equal weights, attributing equal value to the protection by each of the legal and policy documents.

Please execute the following cells to load and visualize the legalWeights used in this study.

In [12]:
legalWeights = pd.read_csv(os.path.join(output_folder, 'legalWeights.csv'), index_col = 0)
In [13]:
bsIO.show_full_data_frame(legalWeights)
The size/shape of data frame is (number of rows, columns): (16, 3)
Out[13]:
major minor weights
codes
RL_NT Red List Near threatened 1
RL_VU Red List Vulnerable 1
RL_EN Red List Endangered 1
RL_CR Red List Critically endangered 1
RL_EX Red List Extinct 1
FF_Table1 Flora- & Fauna Act Table 1 1
FF_Table2 Flora- & Fauna Act Table 2 1
FF_Table3 Flora- & Fauna Act Table 3 1
FF_Birds Flora- & Fauna Act Birds 1
HabDir_II Habitats Directive Annex II 1
HabDir_IV Habitats Directive Annex IV 1
BirdDir_I Birds Directive Annex I NaN 1
BernConv_1 Bern Convention NaN 1
BonnConv_1 Bonn Convention NaN 1
BernConv_2 Bern Convention NaN 1
BonnConv_2 Bonn Convention NaN 1

The second input is linksLaw (Legal Links), which is a relational matrix that links species(s) along the rows to the relevant policy and legislative documents (legalWeights) along the columns. If a species is protected by or mentioned in a specific law, the corresponding cell in the matrix is given a value of one, else the cell is zero.

Please execute the following cells to load and visualize the linksLaw used in this study.

In [14]:
linksLaw = pd.read_csv(os.path.join(output_folder, 'linksLaw.csv'), index_col = 0)
In [15]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(linksLaw)

The third input is linksEco (Ecotope Links), which is the relational matrix between species and ecotopes. The matrix is based on expert ecological judgement of species and their hydromorphological and vegetation habitat needs in different life stages.

Please execute the following cells to load and visualize the linksEco used in this study.

In [16]:
linksEco = pd.read_csv(os.path.join(output_folder, 'linksEco.csv'), index_col = 0)
In [17]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(linksEco)

The column titles in linksEco represent the ecotope classes used in this study. In addition to them, we introduce their merged/main classes based on the following relationship matrix lut that can be loaded and visualized by executing the following notebook cells.

In [18]:
#~ # using excel file
#~ excelFile = os.path.join(output_folder, 'BIOSAFE_20150629.xlsx')
#~ lut = pd.read_excel(excelFile, sheet_name = 'lut_RWES').fillna(method='ffill')

# using csv file
csvFile = os.path.join(input_dir_source, 'lut_RWES.csv')
lut = pd.read_csv(csvFile, index_col = 0)
In [19]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(lut)

In the matrix lut, the column oldEcotope represents the ecotope classes given along the top rows of linksEco, while the classes in the column newEcotope are their merged ecotope classes. Based on lut (relation between oldEcotope and newEcotope) and by running the following notebook cells, we can derive and visualize the Ecotope Links linksNewEcoAgg, consisting oldEcotope and newEcotope.

In [20]:
linksNewEcoAgg = biosafe.aggregateEcotopes(linksEco, lut)
In [21]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(linksNewEcoAgg)
In [22]:
print(linksEco.shape)
print(linksNewEcoAgg.shape)
(1014, 83)
(1014, 124)

Understanding/testing BIOSAFE in a simple instance (non-spatial mode)

To understand the BIOSAFE model, we introduce the following exercise running the BIOSAFE model in a simple single instance, without relevant spatial information.

For this exercise, we randomly draw the presence of each species by running the following cells. The assumption drawn is given in the table, particularly in the column speciesPresence, with the values 0 and 1 indicating absent and present.

In [23]:
speciesPresence = pd.DataFrame(np.random.randint(2, size=len(linksLaw)),\
                    columns=['speciesPresence'], \
                    index=linksLaw.index)
speciesPresenceFull = speciesPresence
In [24]:
# TODO: Menno has to define a method to simplify, to reduce the number of specieses. 
In [25]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(speciesPresence)

For this exercise, we simplify all areas of ecotope classes (ecotopeArea) equal to 1e5 m2. This is done by running the following cell.

In [26]:
ecotopeArea = pd.DataFrame(np.ones(len(linksNewEcoAgg.columns)-1) * 1e5,\
                           columns = ['area_m2'],\
                           index = linksNewEcoAgg.columns.values[0:-1])
In [27]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(ecotopeArea)

Running the BIOSAFE in a simple single instance (non-spatial mode)

Given the inputs legalWeights, linksLaw and linksNewEcoAgg, as well as the assumptions speciesPresence and ecotopeArea defined above, the BIOSAFE model is initiated by running the following cell.

In [28]:
bs = biosafe.biosafe(legalWeights, linksLaw, linksNewEcoAgg, speciesPresence, ecotopeArea)

Then, we can calculate all BIOSAFE scores (potential and actual ones).

In [29]:
SScoresSpecies = bs.SScoresSpecies()
summarySScores = bs.taxGroupSums()
SEcoPot = bs.SEcoPot()
SEcoAct = bs.SEcoAct()
PTE = bs.PTE()
ATE = bs.ATE()
TES = bs.TES()
TEI = bs.TEI()
ATEI = bs.ATEI()
TFI = bs.TFI()
FI = bs.FI()
ATFI = bs.ATFI()
AFI = bs.AFI()
FIS = bs.FIS()
TFIS = bs.TFIS()
TFHS = bs.TFHS()
FTEI = bs.FTEI()

Exploring the BIOSAFE scores/indices

After running the BIOSAFE model, we would explore the BIOSAFE scores/indices by running the following cells. Note that we distinguish between potential biodiversity indices, which depend on ecotope presence only, and actual biodiversity indices, which combine ecotope and species presences. To understand the description of each score, we refer to the supplementary material of Straatsma et al. (2017) that provides all equations to calculate these scores. Figure S1 in the supplementary material shows the flow chart of the BIOSAFE methodology, while a graphical illustration of BIOSAFE score computation is given in Figure S2.

Note that during this exploration, you may want to skip some cells for visualizing some values in data frames or clear their outputs after executing them, particularly if they involve large data frames.

We start this exploration with SScoresSpecies that consists of the calculated potential and actual species scores, Spotential and Sactual (PSS and ASS in the paper). For each species, their calculated values are given as follows.

In [30]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(SScoresSpecies)

Based on SPotential and SActual, the potential and actual taxonomic group scores, PTB and ATB, can be calculated for each taxonomic group as follows. In addition, the taxonomic group biodiversity, TBS, saturation can also be calculated.

In [31]:
bsIO.show_full_data_frame(summarySScores)
The size/shape of data frame is (number of rows, columns): (7, 3)
Out[31]:
PTB ATB TBS
taxonomicGroup
Birds 586 312 53.242321
Butterflies 25 9 36.000000
DragonDamselflies 23 12 52.173913
Fish 39 20 51.282051
Herpetofauna 30 16 53.333333
HigherPlants 368 202 54.891304
Mammals 78 33 42.307692

For each ecotope class, we can also compute the potential and actual species specific scores for each ecotope. Their values for each species and ecotope areas are given in the following two cells, the first one shows their potential scores, SEcoPot, while the latter contains their actual scores, SEcoAct.

In [32]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(SEcoPot)
In [33]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# bsIO.show_full_data_frame(SEcoAct)

For each taxonomic group and for each ecotope class, the sum of SEcoPot can be calculated as PTE, potential taxonomic group ecotope constant.

In [34]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
bsIO.show_full_data_frame(PTE)
The size/shape of data frame is (number of rows, columns): (7, 123)
Out[34]:
RzDz RzDh RzMz RzMh RzOz RzOh RnMz RnMh RnOz RnOh RvDz RvDk RvDh RvMz RvMk RvMh RvOz RvOk RvOh RwDz RwDh RwMz RwMh RwOz RwOh GzOz GzKz GoKz I.1 I.3 II.1 II.2 II.4 II.9 III.2 III.3 OK-1 IV.1 IV.2 IV.3 IV.6 IV.8 IV.9 HM-1 HM-2 V.1 V.2 OR-1 UR-1 HR-1 VII.1 VII.2 OG-1 UG-1 HG-1 VII.3 OG-2 UG-2 HG-2 VI.1 VI.2 OB-2 UB-2 HB-2 VI.3 VI.4 OB-1 UB-1 HB-1 VI.7 VI.8 OB-3 UB-3 HB-3 IX.a OA-1 UA-1 HA-1 OA-2 UA-2 HA-2 REST HG-1-2 HP-1 III.2-3 IV.8-9 O-UA-1 O-UA-2 O-UB-1 O-UB-2 O-UB-3 O-UB-4 O-UB-5 O-UG-1 O-UG-1-2 O-UG-2 O-UP-1 O-UR-1 RnD RnM RnO RtD RtM RtO RvD RvM RvO RwD RwM RwO RzD RzM RzO UB-4 UB-5 UG-1-2 UM-1 UP-1 V.1-2 VI.2-3 VII.1-2 VII.1-3 VII.4
taxonomicGroup
Birds 37 41 48 52 80 84 105 109 168 172 90 90 100 116 127 127 207 219 216 91 91 124 128 227 231 141 140 130 13 57 24 106 94 17 14 22 64 50 105 78 85 102 156 136 64 213 98 77 71 74 126 159 109 146 132 97 76 109 96 67 56 43 44 82 60 131 109 117 135 22 0 64 64 69 59 75 83 92 27 28 35 34 153 92 26 176 87 30 124 60 76 124 124 155 182 111 85 85 109 109 172 109 109 172 100 127 219 95 128 231 41 52 84 64 64 171 253 83 213 91 172 165 35
Butterflies 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 2 0 2 5 5 8 14 7 10 1 1 0 2 0 5 3 4 3 5 8 5 4 0 1 2 4 2 0 0 1 3 0 0 0 0 7 3 0 0 1 0 8 5 4 8 8 18 18 1 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 14 0 1 0 3 10 10 0
DragonDamselflies 0 0 10 7 10 7 14 11 14 11 0 0 0 8 4 5 8 4 9 0 0 8 4 8 4 0 0 0 0 4 1 10 0 0 0 0 0 3 4 4 0 0 5 5 0 4 0 9 5 9 5 0 0 4 4 0 0 0 0 5 14 18 18 18 0 9 13 13 13 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 5 0 0 13 18 0 13 13 4 4 0 9 9 15 15 15 15 15 15 0 9 9 0 8 8 0 11 11 0 0 4 8 0 4 14 5 5 1
Fish 27 27 27 27 18 20 18 18 18 20 4 4 6 12 12 8 12 12 8 1 3 10 6 10 4 7 13 12 2 8 18 8 3 0 4 3 0 7 7 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 18 18 20 18 18 20 6 14 14 3 12 12 27 27 20 0 0 0 7 0 0 0 0 0 18
Herpetofauna 0 0 3 3 6 6 7 7 8 8 7 7 7 8 8 8 12 12 12 17 13 23 17 26 21 7 7 1 8 9 0 8 0 0 0 0 8 19 19 14 5 14 14 7 3 20 20 18 9 18 19 12 9 16 1 1 0 4 0 9 18 15 13 15 14 8 15 10 15 10 2 11 6 7 0 8 0 8 1 1 10 8 1 8 0 14 8 1 19 22 15 19 19 20 20 4 22 22 7 7 8 7 7 8 7 8 12 17 23 26 0 3 6 6 6 16 19 0 20 18 19 19 0
HigherPlants 0 0 1 1 1 1 2 1 1 1 0 0 0 6 2 1 28 15 6 1 0 6 0 29 4 6 5 1 0 1 14 15 13 10 1 13 37 6 16 7 9 6 47 7 1 33 7 43 11 22 41 19 101 64 93 11 18 14 7 13 1 29 16 35 4 24 58 34 54 4 5 24 25 20 1 33 9 43 6 2 21 15 94 43 14 50 34 8 64 35 30 64 64 130 138 24 49 49 2 2 1 2 2 1 0 7 29 1 6 29 0 1 1 25 25 71 73 9 40 5 56 48 22
Mammals 4 4 13 4 15 4 18 9 20 9 36 36 27 36 36 27 40 41 29 36 27 36 27 40 31 22 23 23 18 19 2 22 18 12 0 0 4 13 28 27 26 13 23 18 12 24 1 15 29 20 22 40 30 35 33 1 4 6 6 26 30 31 37 36 12 27 50 55 45 5 16 36 39 38 3 8 12 14 34 34 27 5 33 14 0 24 12 34 55 37 39 55 55 35 35 6 29 29 18 18 20 18 18 20 36 36 41 36 36 40 4 13 15 39 39 35 37 12 24 36 40 23 14

For each taxonomic group and for each ecotope class, the sum of SEcoAct can be calculated as ATE, actual taxonomic group ecotope constant.

In [35]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
bsIO.show_full_data_frame(ATE)
The size/shape of data frame is (number of rows, columns): (7, 123)
Out[35]:
RzDz RzDh RzMz RzMh RzOz RzOh RnMz RnMh RnOz RnOh RvDz RvDk RvDh RvMz RvMk RvMh RvOz RvOk RvOh RwDz RwDh RwMz RwMh RwOz RwOh GzOz GzKz GoKz I.1 I.3 II.1 II.2 II.4 II.9 III.2 III.3 OK-1 IV.1 IV.2 IV.3 IV.6 IV.8 IV.9 HM-1 HM-2 V.1 V.2 OR-1 UR-1 HR-1 VII.1 VII.2 OG-1 UG-1 HG-1 VII.3 OG-2 UG-2 HG-2 VI.1 VI.2 OB-2 UB-2 HB-2 VI.3 VI.4 OB-1 UB-1 HB-1 VI.7 VI.8 OB-3 UB-3 HB-3 IX.a OA-1 UA-1 HA-1 OA-2 UA-2 HA-2 REST HG-1-2 HP-1 III.2-3 IV.8-9 O-UA-1 O-UA-2 O-UB-1 O-UB-2 O-UB-3 O-UB-4 O-UB-5 O-UG-1 O-UG-1-2 O-UG-2 O-UP-1 O-UR-1 RnD RnM RnO RtD RtM RtO RvD RvM RvO RwD RwM RwO RzD RzM RzO UB-4 UB-5 UG-1-2 UM-1 UP-1 V.1-2 VI.2-3 VII.1-2 VII.1-3 VII.4
taxonomicGroup
Birds 14 18 23 27 32 36 55 59 81 85 40 40 44 55 66 66 115 119 116 38 38 56 60 123 127 73 69 64 2 25 2 63 55 5 2 10 33 23 55 54 54 58 93 77 35 117 51 44 42 47 88 103 73 93 82 60 40 61 53 43 29 23 30 36 42 79 63 63 72 13 0 27 26 31 32 44 47 57 18 19 22 14 92 57 10 107 51 21 63 37 30 63 63 98 108 63 51 51 59 59 85 59 59 85 44 66 119 42 60 127 18 27 36 26 26 101 149 47 117 56 108 105 5
Butterflies 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 0 2 0 2 3 2 3 0 0 0 0 2 0 2 2 2 3 4 6 3 2 0 0 0 2 0 0 0 1 1 0 0 0 0 3 1 0 0 1 0 6 2 2 6 6 3 3 0 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 0 1 0 3 2 0 0
DragonDamselflies 0 0 4 0 4 0 4 0 4 0 0 0 0 8 4 4 8 4 8 0 0 8 4 8 4 0 0 0 0 4 0 4 0 0 0 0 0 3 4 4 0 0 5 5 0 4 0 8 4 8 4 0 0 4 4 0 0 0 0 0 4 8 8 8 0 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 5 0 0 4 8 0 4 4 4 4 0 8 8 4 4 4 4 4 4 0 8 8 0 8 8 0 4 4 0 0 4 8 0 4 4 4 4 0
Fish 12 12 12 12 12 12 12 12 12 12 4 4 6 12 12 8 12 12 8 1 3 10 6 8 4 5 5 4 2 6 10 5 3 0 4 3 0 7 7 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 12 12 12 12 12 12 6 14 14 3 12 10 12 12 12 0 0 0 7 0 0 0 0 0 10
Herpetofauna 0 0 0 0 1 1 1 1 2 2 1 1 1 2 2 2 6 6 6 6 2 12 6 12 10 1 1 1 4 5 0 8 0 0 0 0 8 8 8 8 2 8 8 4 0 6 6 12 4 12 10 4 8 8 0 0 0 0 0 4 5 9 5 9 1 1 9 5 9 0 1 5 1 1 0 8 0 8 0 0 4 8 0 8 0 8 8 0 9 9 5 9 9 12 12 0 12 12 1 1 2 1 1 2 1 2 6 6 12 12 0 0 1 1 1 8 8 0 6 5 10 10 0
HigherPlants 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 17 9 4 1 0 5 0 18 2 2 2 1 0 0 8 13 10 3 1 10 21 4 9 4 3 5 21 3 0 22 3 23 6 17 17 5 51 32 52 5 6 7 2 7 1 11 6 17 3 11 27 16 28 1 2 10 11 9 1 15 5 22 5 0 12 8 52 22 11 24 15 5 29 13 14 29 29 68 73 10 26 26 0 0 0 0 0 0 0 5 18 1 5 18 0 0 0 11 11 37 34 5 25 4 22 20 11
Mammals 4 4 4 4 6 4 9 9 11 9 16 16 16 16 16 16 18 19 16 16 16 16 16 18 18 11 12 12 9 10 0 11 7 3 0 0 4 8 16 17 15 8 16 13 8 13 1 3 14 8 11 19 14 17 13 0 2 4 4 6 8 7 11 11 6 13 19 21 14 4 8 8 10 12 2 4 7 6 13 13 6 3 13 6 0 17 7 13 21 11 10 21 21 17 17 4 14 14 9 9 11 9 9 11 16 16 19 16 16 18 4 4 6 10 10 17 22 7 13 13 19 11 3

Based on ATE and PTE, we can calculate TES, taxonomic group ecotope saturation index, for each taxonomic group and ecotope area.

In [36]:
bsIO.show_full_data_frame(TES)
The size/shape of data frame is (number of rows, columns): (7, 123)
Out[36]:
RzDz RzDh RzMz RzMh RzOz RzOh RnMz RnMh RnOz RnOh RvDz RvDk RvDh RvMz RvMk RvMh RvOz RvOk RvOh RwDz RwDh RwMz RwMh RwOz RwOh GzOz GzKz GoKz I.1 I.3 II.1 II.2 II.4 II.9 III.2 III.3 OK-1 IV.1 IV.2 IV.3 IV.6 IV.8 IV.9 HM-1 HM-2 V.1 V.2 OR-1 UR-1 HR-1 VII.1 VII.2 OG-1 UG-1 HG-1 VII.3 OG-2 UG-2 HG-2 VI.1 VI.2 OB-2 UB-2 HB-2 VI.3 VI.4 OB-1 UB-1 HB-1 VI.7 VI.8 OB-3 UB-3 HB-3 IX.a OA-1 UA-1 HA-1 OA-2 UA-2 HA-2 REST HG-1-2 HP-1 III.2-3 IV.8-9 O-UA-1 O-UA-2 O-UB-1 O-UB-2 O-UB-3 O-UB-4 O-UB-5 O-UG-1 O-UG-1-2 O-UG-2 O-UP-1 O-UR-1 RnD RnM RnO RtD RtM RtO RvD RvM RvO RwD RwM RwO RzD RzM RzO UB-4 UB-5 UG-1-2 UM-1 UP-1 V.1-2 VI.2-3 VII.1-2 VII.1-3 VII.4
taxonomicGroup
Birds 37.837838 43.902439 47.916667 51.923077 40.000000 42.857143 52.380952 54.128440 48.214286 49.418605 44.444444 44.444444 44.000000 47.413793 51.968504 51.968504 55.555556 54.337900 53.703704 41.758242 41.758242 45.161290 46.875000 54.185022 54.978355 51.773050 49.285714 49.230769 15.384615 43.859649 8.333333 59.433962 58.510638 29.411765 14.285714 45.454545 51.562500 46.000000 52.380952 69.230769 63.529412 56.862745 59.615385 56.617647 54.687500 54.929577 52.040816 57.142857 59.154930 63.513514 69.841270 64.779874 66.972477 63.698630 62.121212 61.855670 52.631579 55.963303 55.208333 64.179104 51.785714 53.488372 68.181818 43.902439 70.000000 60.305344 57.798165 53.846154 53.333333 59.090909 0.0 42.187500 40.625000 44.927536 54.237288 58.666667 56.626506 61.956522 66.666667 67.857143 62.857143 41.176471 60.130719 61.956522 38.461538 60.795455 58.620690 70.000000 50.806452 61.666667 39.473684 50.806452 50.806452 63.225806 59.340659 56.756757 60.000000 60.000000 54.128440 54.128440 49.418605 54.128440 54.128440 49.418605 44.000000 51.968504 54.337900 44.210526 46.875000 54.978355 43.902439 51.923077 42.857143 40.625000 40.625000 59.064327 58.893281 56.626506 54.929577 61.538462 62.790698 63.636364 14.285714
Butterflies 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 50.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 100.000000 0.000000 100.000000 0.000000 40.000000 37.500000 14.285714 42.857143 0.000000 0.000000 0.000000 0.000000 100.000000 0.000000 40.000000 66.666667 50.000000 100.000000 80.000000 75.000000 60.000000 50.000000 0.000000 0.0 0.000000 50.000000 0.000000 0.000000 0.000000 100.000000 33.333333 0.000000 0.000000 0.000000 0.000000 42.857143 33.333333 0.000000 0.000000 100.000000 0.000000 75.000000 40.000000 50.000000 75.000000 75.000000 16.666667 16.666667 0.000000 100.000000 100.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 50.000000 50.000000 14.285714 0.000000 100.000000 0.000000 100.000000 20.000000 0.000000 0.000000
DragonDamselflies 0.000000 0.000000 40.000000 0.000000 40.000000 0.000000 28.571429 0.000000 28.571429 0.000000 0.000000 0.000000 0.000000 100.000000 100.000000 80.000000 100.000000 100.000000 88.888889 0.000000 0.000000 100.000000 100.000000 100.000000 100.000000 0.000000 0.000000 0.000000 0.000000 100.000000 0.000000 40.000000 0.000000 0.000000 0.000000 0.000000 0.000000 100.000000 100.000000 100.000000 0.000000 0.000000 100.000000 100.000000 0.000000 100.000000 0.000000 88.888889 80.000000 88.888889 80.000000 0.000000 0.000000 100.000000 100.000000 0.000000 0.000000 0.000000 0.000000 0.000000 28.571429 44.444444 44.444444 44.444444 0.000000 44.444444 30.769231 30.769231 30.769231 0.000000 0.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 100.000000 0.000000 0.000000 100.000000 0.000000 0.000000 30.769231 44.444444 0.000000 30.769231 30.769231 100.000000 100.000000 0.000000 88.888889 88.888889 26.666667 26.666667 26.666667 26.666667 26.666667 26.666667 0.000000 88.888889 88.888889 0.000000 100.000000 100.000000 0.000000 36.363636 36.363636 0.000000 0.000000 100.000000 100.000000 0.000000 100.000000 28.571429 80.000000 80.000000 0.000000
Fish 44.444444 44.444444 44.444444 44.444444 66.666667 60.000000 66.666667 66.666667 66.666667 60.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 80.000000 100.000000 71.428571 38.461538 33.333333 100.000000 75.000000 55.555556 62.500000 100.000000 0.000000 100.000000 100.000000 0.000000 100.000000 100.000000 100.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 100.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 66.666667 66.666667 60.000000 66.666667 66.666667 60.000000 100.000000 100.000000 100.000000 100.000000 100.000000 83.333333 44.444444 44.444444 60.000000 0.000000 0.000000 0.000000 100.000000 0.000000 0.000000 0.000000 0.000000 0.000000 55.555556
Herpetofauna 0.000000 0.000000 0.000000 0.000000 16.666667 16.666667 14.285714 14.285714 25.000000 25.000000 14.285714 14.285714 14.285714 25.000000 25.000000 25.000000 50.000000 50.000000 50.000000 35.294118 15.384615 52.173913 35.294118 46.153846 47.619048 14.285714 14.285714 100.000000 50.000000 55.555556 0.000000 100.000000 0.000000 0.000000 0.000000 0.000000 100.000000 42.105263 42.105263 57.142857 40.000000 57.142857 57.142857 57.142857 0.000000 30.000000 30.000000 66.666667 44.444444 66.666667 52.631579 33.333333 88.888889 50.000000 0.000000 0.000000 0.000000 0.000000 0.000000 44.444444 27.777778 60.000000 38.461538 60.000000 7.142857 12.500000 60.000000 50.000000 60.000000 0.000000 50.0 45.454545 16.666667 14.285714 0.000000 100.000000 0.000000 100.000000 0.000000 0.000000 40.000000 100.000000 0.000000 100.000000 0.000000 57.142857 100.000000 0.000000 47.368421 40.909091 33.333333 47.368421 47.368421 60.000000 60.000000 0.000000 54.545455 54.545455 14.285714 14.285714 25.000000 14.285714 14.285714 25.000000 14.285714 25.000000 50.000000 35.294118 52.173913 46.153846 0.000000 0.000000 16.666667 16.666667 16.666667 50.000000 42.105263 0.000000 30.000000 27.777778 52.631579 52.631579 0.000000
HigherPlants 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 83.333333 0.000000 0.000000 60.714286 60.000000 66.666667 100.000000 0.000000 83.333333 0.000000 62.068966 50.000000 33.333333 40.000000 100.000000 0.000000 0.000000 57.142857 86.666667 76.923077 30.000000 100.000000 76.923077 56.756757 66.666667 56.250000 57.142857 33.333333 83.333333 44.680851 42.857143 0.000000 66.666667 42.857143 53.488372 54.545455 77.272727 41.463415 26.315789 50.495050 50.000000 55.913978 45.454545 33.333333 50.000000 28.571429 53.846154 100.000000 37.931034 37.500000 48.571429 75.000000 45.833333 46.551724 47.058824 51.851852 25.000000 40.0 41.666667 44.000000 45.000000 100.000000 45.454545 55.555556 51.162791 83.333333 0.000000 57.142857 53.333333 55.319149 51.162791 78.571429 48.000000 44.117647 62.500000 45.312500 37.142857 46.666667 45.312500 45.312500 52.307692 52.898551 41.666667 53.061224 53.061224 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 71.428571 62.068966 100.000000 83.333333 62.068966 0.000000 0.000000 0.000000 44.000000 44.000000 52.112676 46.575342 55.555556 62.500000 80.000000 39.285714 41.666667 50.000000
Mammals 100.000000 100.000000 30.769231 100.000000 40.000000 100.000000 50.000000 100.000000 55.000000 100.000000 44.444444 44.444444 59.259259 44.444444 44.444444 59.259259 45.000000 46.341463 55.172414 44.444444 59.259259 44.444444 59.259259 45.000000 58.064516 50.000000 52.173913 52.173913 50.000000 52.631579 0.000000 50.000000 38.888889 25.000000 0.000000 0.000000 100.000000 61.538462 57.142857 62.962963 57.692308 61.538462 69.565217 72.222222 66.666667 54.166667 100.000000 20.000000 48.275862 40.000000 50.000000 47.500000 46.666667 48.571429 39.393939 0.000000 50.000000 66.666667 66.666667 23.076923 26.666667 22.580645 29.729730 30.555556 50.000000 48.148148 38.000000 38.181818 31.111111 80.000000 50.0 22.222222 25.641026 31.578947 66.666667 50.000000 58.333333 42.857143 38.235294 38.235294 22.222222 60.000000 39.393939 42.857143 0.000000 70.833333 58.333333 38.235294 38.181818 29.729730 25.641026 38.181818 38.181818 48.571429 48.571429 66.666667 48.275862 48.275862 50.000000 50.000000 55.000000 50.000000 50.000000 55.000000 44.444444 44.444444 46.341463 44.444444 44.444444 45.000000 100.000000 30.769231 40.000000 25.641026 25.641026 48.571429 59.459459 58.333333 54.166667 36.111111 47.500000 47.826087 21.428571

Based on PTB and PTE, we can calculate TEI, taxonomic group ecotope importance constant, for each taxonomic group and ecotope area.

In [37]:
bsIO.show_full_data_frame(TEI)
The size/shape of data frame is (number of rows, columns): (7, 123)
Out[37]:
RzDz RzDh RzMz RzMh RzOz RzOh RnMz RnMh RnOz RnOh RvDz RvDk RvDh RvMz RvMk RvMh RvOz RvOk RvOh RwDz RwDh RwMz RwMh RwOz RwOh GzOz GzKz GoKz I.1 I.3 II.1 II.2 II.4 II.9 III.2 III.3 OK-1 IV.1 IV.2 IV.3 IV.6 IV.8 IV.9 HM-1 HM-2 V.1 V.2 OR-1 UR-1 HR-1 VII.1 VII.2 OG-1 UG-1 HG-1 VII.3 OG-2 UG-2 HG-2 VI.1 VI.2 OB-2 UB-2 HB-2 VI.3 VI.4 OB-1 UB-1 HB-1 VI.7 VI.8 OB-3 UB-3 HB-3 IX.a OA-1 UA-1 HA-1 OA-2 UA-2 HA-2 REST HG-1-2 HP-1 III.2-3 IV.8-9 O-UA-1 O-UA-2 O-UB-1 O-UB-2 O-UB-3 O-UB-4 O-UB-5 O-UG-1 O-UG-1-2 O-UG-2 O-UP-1 O-UR-1 RnD RnM RnO RtD RtM RtO RvD RvM RvO RwD RwM RwO RzD RzM RzO UB-4 UB-5 UG-1-2 UM-1 UP-1 V.1-2 VI.2-3 VII.1-2 VII.1-3 VII.4
taxonomicGroup
Birds 6.313993 6.996587 8.191126 8.873720 13.651877 14.334471 17.918089 18.600683 28.668942 29.351536 15.358362 15.358362 17.064846 19.795222 21.672355 21.672355 35.324232 37.372014 36.860068 15.529010 15.529010 21.160410 21.843003 38.737201 39.419795 24.061433 23.890785 22.184300 2.218430 9.726962 4.095563 18.088737 16.040956 2.901024 2.389078 3.754266 10.921502 8.532423 17.918089 13.310580 14.505119 17.406143 26.621160 23.208191 10.921502 36.348123 16.723549 13.139932 12.116041 12.627986 21.501706 27.133106 18.600683 24.914676 22.525597 16.552901 12.969283 18.600683 16.382253 11.433447 9.556314 7.337884 7.508532 13.993174 10.238908 22.354949 18.600683 19.965870 23.037543 3.754266 0.000000 10.921502 10.921502 11.774744 10.068259 12.798635 14.163823 15.699659 4.607509 4.778157 5.972696 5.802048 26.109215 15.699659 4.436860 30.034130 14.846416 5.119454 21.160410 10.238908 12.969283 21.160410 21.160410 26.450512 31.058020 18.941980 14.505119 14.505119 18.600683 18.600683 29.351536 18.600683 18.600683 29.351536 17.064846 21.672355 37.372014 16.211604 21.843003 39.419795 6.996587 8.873720 14.334471 10.921502 10.921502 29.180887 43.174061 14.163823 36.348123 15.529010 29.351536 28.156997 5.972696
Butterflies 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 8.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 8.000000 0.000000 8.000000 20.000000 20.000000 32.000000 56.000000 28.000000 40.000000 4.000000 4.000000 0.000000 8.000000 0.000000 20.000000 12.000000 16.000000 12.000000 20.000000 32.000000 20.000000 16.000000 0.000000 4.000000 8.000000 16.000000 8.000000 0.000000 0.000000 4.000000 12.000000 0.000000 0.000000 0.000000 0.000000 28.000000 12.000000 0.000000 0.000000 4.000000 0.000000 32.000000 20.000000 16.000000 32.000000 32.000000 72.000000 72.000000 4.000000 8.000000 8.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 16.000000 16.000000 56.000000 0.000000 4.000000 0.000000 12.000000 40.000000 40.000000 0.000000
DragonDamselflies 0.000000 0.000000 43.478261 30.434783 43.478261 30.434783 60.869565 47.826087 60.869565 47.826087 0.000000 0.000000 0.000000 34.782609 17.391304 21.739130 34.782609 17.391304 39.130435 0.000000 0.000000 34.782609 17.391304 34.782609 17.391304 0.000000 0.000000 0.000000 0.000000 17.391304 4.347826 43.478261 0.000000 0.000000 0.000000 0.000000 0.000000 13.043478 17.391304 17.391304 0.000000 0.000000 21.739130 21.739130 0.000000 17.391304 0.000000 39.130435 21.739130 39.130435 21.739130 0.000000 0.000000 17.391304 17.391304 0.000000 0.000000 0.000000 0.000000 21.739130 60.869565 78.260870 78.260870 78.260870 0.000000 39.130435 56.521739 56.521739 56.521739 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 17.391304 0.000000 0.000000 21.739130 0.000000 0.000000 56.521739 78.260870 0.000000 56.521739 56.521739 17.391304 17.391304 0.000000 39.130435 39.130435 65.217391 65.217391 65.217391 65.217391 65.217391 65.217391 0.000000 39.130435 39.130435 0.000000 34.782609 34.782609 0.000000 47.826087 47.826087 0.000000 0.000000 17.391304 34.782609 0.000000 17.391304 60.869565 21.739130 21.739130 4.347826
Fish 69.230769 69.230769 69.230769 69.230769 46.153846 51.282051 46.153846 46.153846 46.153846 51.282051 10.256410 10.256410 15.384615 30.769231 30.769231 20.512821 30.769231 30.769231 20.512821 2.564103 7.692308 25.641026 15.384615 25.641026 10.256410 17.948718 33.333333 30.769231 5.128205 20.512821 46.153846 20.512821 7.692308 0.000000 10.256410 7.692308 0.000000 17.948718 17.948718 10.256410 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 10.256410 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 46.153846 46.153846 51.282051 46.153846 46.153846 51.282051 15.384615 35.897436 35.897436 7.692308 30.769231 30.769231 69.230769 69.230769 51.282051 0.000000 0.000000 0.000000 17.948718 0.000000 0.000000 0.000000 0.000000 0.000000 46.153846
Herpetofauna 0.000000 0.000000 10.000000 10.000000 20.000000 20.000000 23.333333 23.333333 26.666667 26.666667 23.333333 23.333333 23.333333 26.666667 26.666667 26.666667 40.000000 40.000000 40.000000 56.666667 43.333333 76.666667 56.666667 86.666667 70.000000 23.333333 23.333333 3.333333 26.666667 30.000000 0.000000 26.666667 0.000000 0.000000 0.000000 0.000000 26.666667 63.333333 63.333333 46.666667 16.666667 46.666667 46.666667 23.333333 10.000000 66.666667 66.666667 60.000000 30.000000 60.000000 63.333333 40.000000 30.000000 53.333333 3.333333 3.333333 0.000000 13.333333 0.000000 30.000000 60.000000 50.000000 43.333333 50.000000 46.666667 26.666667 50.000000 33.333333 50.000000 33.333333 6.666667 36.666667 20.000000 23.333333 0.000000 26.666667 0.000000 26.666667 3.333333 3.333333 33.333333 26.666667 3.333333 26.666667 0.000000 46.666667 26.666667 3.333333 63.333333 73.333333 50.000000 63.333333 63.333333 66.666667 66.666667 13.333333 73.333333 73.333333 23.333333 23.333333 26.666667 23.333333 23.333333 26.666667 23.333333 26.666667 40.000000 56.666667 76.666667 86.666667 0.000000 10.000000 20.000000 20.000000 20.000000 53.333333 63.333333 0.000000 66.666667 60.000000 63.333333 63.333333 0.000000
HigherPlants 0.000000 0.000000 0.271739 0.271739 0.271739 0.271739 0.543478 0.271739 0.271739 0.271739 0.000000 0.000000 0.000000 1.630435 0.543478 0.271739 7.608696 4.076087 1.630435 0.271739 0.000000 1.630435 0.000000 7.880435 1.086957 1.630435 1.358696 0.271739 0.000000 0.271739 3.804348 4.076087 3.532609 2.717391 0.271739 3.532609 10.054348 1.630435 4.347826 1.902174 2.445652 1.630435 12.771739 1.902174 0.271739 8.967391 1.902174 11.684783 2.989130 5.978261 11.141304 5.163043 27.445652 17.391304 25.271739 2.989130 4.891304 3.804348 1.902174 3.532609 0.271739 7.880435 4.347826 9.510870 1.086957 6.521739 15.760870 9.239130 14.673913 1.086957 1.358696 6.521739 6.793478 5.434783 0.271739 8.967391 2.445652 11.684783 1.630435 0.543478 5.706522 4.076087 25.543478 11.684783 3.804348 13.586957 9.239130 2.173913 17.391304 9.510870 8.152174 17.391304 17.391304 35.326087 37.500000 6.521739 13.315217 13.315217 0.543478 0.543478 0.271739 0.543478 0.543478 0.271739 0.000000 1.902174 7.880435 0.271739 1.630435 7.880435 0.000000 0.271739 0.271739 6.793478 6.793478 19.293478 19.836957 2.445652 10.869565 1.358696 15.217391 13.043478 5.978261
Mammals 5.128205 5.128205 16.666667 5.128205 19.230769 5.128205 23.076923 11.538462 25.641026 11.538462 46.153846 46.153846 34.615385 46.153846 46.153846 34.615385 51.282051 52.564103 37.179487 46.153846 34.615385 46.153846 34.615385 51.282051 39.743590 28.205128 29.487179 29.487179 23.076923 24.358974 2.564103 28.205128 23.076923 15.384615 0.000000 0.000000 5.128205 16.666667 35.897436 34.615385 33.333333 16.666667 29.487179 23.076923 15.384615 30.769231 1.282051 19.230769 37.179487 25.641026 28.205128 51.282051 38.461538 44.871795 42.307692 1.282051 5.128205 7.692308 7.692308 33.333333 38.461538 39.743590 47.435897 46.153846 15.384615 34.615385 64.102564 70.512821 57.692308 6.410256 20.512821 46.153846 50.000000 48.717949 3.846154 10.256410 15.384615 17.948718 43.589744 43.589744 34.615385 6.410256 42.307692 17.948718 0.000000 30.769231 15.384615 43.589744 70.512821 47.435897 50.000000 70.512821 70.512821 44.871795 44.871795 7.692308 37.179487 37.179487 23.076923 23.076923 25.641026 23.076923 23.076923 25.641026 46.153846 46.153846 52.564103 46.153846 46.153846 51.282051 5.128205 16.666667 19.230769 50.000000 50.000000 44.871795 47.435897 15.384615 30.769231 46.153846 51.282051 29.487179 17.948718

Based on TEI and TES, we can calculate ATEI (ATE in the paper), actual taxonomic group ecotope constant, for each taxonomic group and ecotope area.

In [38]:
bsIO.show_full_data_frame(ATEI)
The size/shape of data frame is (number of rows, columns): (7, 123)
Out[38]:
RzDz RzDh RzMz RzMh RzOz RzOh RnMz RnMh RnOz RnOh RvDz RvDk RvDh RvMz RvMk RvMh RvOz RvOk RvOh RwDz RwDh RwMz RwMh RwOz RwOh GzOz GzKz GoKz I.1 I.3 II.1 II.2 II.4 II.9 III.2 III.3 OK-1 IV.1 IV.2 IV.3 IV.6 IV.8 IV.9 HM-1 HM-2 V.1 V.2 OR-1 UR-1 HR-1 VII.1 VII.2 OG-1 UG-1 HG-1 VII.3 OG-2 UG-2 HG-2 VI.1 VI.2 OB-2 UB-2 HB-2 VI.3 VI.4 OB-1 UB-1 HB-1 VI.7 VI.8 OB-3 UB-3 HB-3 IX.a OA-1 UA-1 HA-1 OA-2 UA-2 HA-2 REST HG-1-2 HP-1 III.2-3 IV.8-9 O-UA-1 O-UA-2 O-UB-1 O-UB-2 O-UB-3 O-UB-4 O-UB-5 O-UG-1 O-UG-1-2 O-UG-2 O-UP-1 O-UR-1 RnD RnM RnO RtD RtM RtO RvD RvM RvO RwD RwM RwO RzD RzM RzO UB-4 UB-5 UG-1-2 UM-1 UP-1 V.1-2 VI.2-3 VII.1-2 VII.1-3 VII.4
taxonomicGroup
Birds 2.389078 3.071672 3.924915 4.607509 5.460751 6.143345 9.385666 10.068259 13.822526 14.505119 6.825939 6.825939 7.508532 9.385666 11.262799 11.262799 19.624573 20.307167 19.795222 6.484642 6.484642 9.556314 10.238908 20.989761 21.672355 12.457338 11.774744 10.921502 0.341297 4.266212 0.341297 10.750853 9.385666 0.853242 0.341297 1.706485 5.631399 3.924915 9.385666 9.215017 9.215017 9.897611 15.870307 13.139932 5.972696 19.965870 8.703072 7.508532 7.167235 8.020478 15.017065 17.576792 12.457338 15.870307 13.993174 10.238908 6.825939 10.409556 9.044369 7.337884 4.948805 3.924915 5.119454 6.143345 7.167235 13.481229 10.750853 10.750853 12.286689 2.218430 0.000000 4.607509 4.436860 5.290102 5.460751 7.508532 8.020478 9.726962 3.071672 3.242321 3.754266 2.389078 15.699659 9.726962 1.706485 18.259386 8.703072 3.583618 10.750853 6.313993 5.119454 10.750853 10.750853 16.723549 18.430034 10.750853 8.703072 8.703072 10.068259 10.068259 14.505119 10.068259 10.068259 14.505119 7.508532 11.262799 20.307167 7.167235 10.238908 21.672355 3.071672 4.607509 6.143345 4.436860 4.436860 17.235495 25.426621 8.020478 19.965870 9.556314 18.430034 17.918089 0.853242
Butterflies 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 4.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 8.000000 0.000000 8.000000 0.000000 8.000000 12.000000 8.000000 12.000000 0.000000 0.000000 0.000000 0.000000 8.000000 0.000000 8.000000 8.000000 8.000000 12.000000 16.000000 24.000000 12.000000 8.000000 0.000000 0.000000 0.000000 8.000000 0.000000 0.000000 0.000000 4.000000 4.000000 0.000000 0.000000 0.000000 0.000000 12.000000 4.000000 0.000000 0.000000 4.000000 0.000000 24.000000 8.000000 8.000000 24.000000 24.000000 12.000000 12.000000 0.000000 8.000000 8.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 8.000000 8.000000 8.000000 0.000000 4.000000 0.000000 12.000000 8.000000 0.000000 0.000000
DragonDamselflies 0.000000 0.000000 17.391304 0.000000 17.391304 0.000000 17.391304 0.000000 17.391304 0.000000 0.000000 0.000000 0.000000 34.782609 17.391304 17.391304 34.782609 17.391304 34.782609 0.000000 0.000000 34.782609 17.391304 34.782609 17.391304 0.000000 0.000000 0.000000 0.000000 17.391304 0.000000 17.391304 0.000000 0.000000 0.000000 0.000000 0.000000 13.043478 17.391304 17.391304 0.000000 0.000000 21.739130 21.739130 0.000000 17.391304 0.000000 34.782609 17.391304 34.782609 17.391304 0.000000 0.000000 17.391304 17.391304 0.000000 0.000000 0.000000 0.000000 0.000000 17.391304 34.782609 34.782609 34.782609 0.000000 17.391304 17.391304 17.391304 17.391304 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 17.391304 0.000000 0.000000 21.739130 0.000000 0.000000 17.391304 34.782609 0.000000 17.391304 17.391304 17.391304 17.391304 0.000000 34.782609 34.782609 17.391304 17.391304 17.391304 17.391304 17.391304 17.391304 0.000000 34.782609 34.782609 0.000000 34.782609 34.782609 0.000000 17.391304 17.391304 0.000000 0.000000 17.391304 34.782609 0.000000 17.391304 17.391304 17.391304 17.391304 0.000000
Fish 30.769231 30.769231 30.769231 30.769231 30.769231 30.769231 30.769231 30.769231 30.769231 30.769231 10.256410 10.256410 15.384615 30.769231 30.769231 20.512821 30.769231 30.769231 20.512821 2.564103 7.692308 25.641026 15.384615 20.512821 10.256410 12.820513 12.820513 10.256410 5.128205 15.384615 25.641026 12.820513 7.692308 0.000000 10.256410 7.692308 0.000000 17.948718 17.948718 10.256410 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 10.256410 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 30.769231 30.769231 30.769231 30.769231 30.769231 30.769231 15.384615 35.897436 35.897436 7.692308 30.769231 25.641026 30.769231 30.769231 30.769231 0.000000 0.000000 0.000000 17.948718 0.000000 0.000000 0.000000 0.000000 0.000000 25.641026
Herpetofauna 0.000000 0.000000 0.000000 0.000000 3.333333 3.333333 3.333333 3.333333 6.666667 6.666667 3.333333 3.333333 3.333333 6.666667 6.666667 6.666667 20.000000 20.000000 20.000000 20.000000 6.666667 40.000000 20.000000 40.000000 33.333333 3.333333 3.333333 3.333333 13.333333 16.666667 0.000000 26.666667 0.000000 0.000000 0.000000 0.000000 26.666667 26.666667 26.666667 26.666667 6.666667 26.666667 26.666667 13.333333 0.000000 20.000000 20.000000 40.000000 13.333333 40.000000 33.333333 13.333333 26.666667 26.666667 0.000000 0.000000 0.000000 0.000000 0.000000 13.333333 16.666667 30.000000 16.666667 30.000000 3.333333 3.333333 30.000000 16.666667 30.000000 0.000000 3.333333 16.666667 3.333333 3.333333 0.000000 26.666667 0.000000 26.666667 0.000000 0.000000 13.333333 26.666667 0.000000 26.666667 0.000000 26.666667 26.666667 0.000000 30.000000 30.000000 16.666667 30.000000 30.000000 40.000000 40.000000 0.000000 40.000000 40.000000 3.333333 3.333333 6.666667 3.333333 3.333333 6.666667 3.333333 6.666667 20.000000 20.000000 40.000000 40.000000 0.000000 0.000000 3.333333 3.333333 3.333333 26.666667 26.666667 0.000000 20.000000 16.666667 33.333333 33.333333 0.000000
HigherPlants 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.358696 0.000000 0.000000 4.619565 2.445652 1.086957 0.271739 0.000000 1.358696 0.000000 4.891304 0.543478 0.543478 0.543478 0.271739 0.000000 0.000000 2.173913 3.532609 2.717391 0.815217 0.271739 2.717391 5.706522 1.086957 2.445652 1.086957 0.815217 1.358696 5.706522 0.815217 0.000000 5.978261 0.815217 6.250000 1.630435 4.619565 4.619565 1.358696 13.858696 8.695652 14.130435 1.358696 1.630435 1.902174 0.543478 1.902174 0.271739 2.989130 1.630435 4.619565 0.815217 2.989130 7.336957 4.347826 7.608696 0.271739 0.543478 2.717391 2.989130 2.445652 0.271739 4.076087 1.358696 5.978261 1.358696 0.000000 3.260870 2.173913 14.130435 5.978261 2.989130 6.521739 4.076087 1.358696 7.880435 3.532609 3.804348 7.880435 7.880435 18.478261 19.836957 2.717391 7.065217 7.065217 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.358696 4.891304 0.271739 1.358696 4.891304 0.000000 0.000000 0.000000 2.989130 2.989130 10.054348 9.239130 1.358696 6.793478 1.086957 5.978261 5.434783 2.989130
Mammals 5.128205 5.128205 5.128205 5.128205 7.692308 5.128205 11.538462 11.538462 14.102564 11.538462 20.512821 20.512821 20.512821 20.512821 20.512821 20.512821 23.076923 24.358974 20.512821 20.512821 20.512821 20.512821 20.512821 23.076923 23.076923 14.102564 15.384615 15.384615 11.538462 12.820513 0.000000 14.102564 8.974359 3.846154 0.000000 0.000000 5.128205 10.256410 20.512821 21.794872 19.230769 10.256410 20.512821 16.666667 10.256410 16.666667 1.282051 3.846154 17.948718 10.256410 14.102564 24.358974 17.948718 21.794872 16.666667 0.000000 2.564103 5.128205 5.128205 7.692308 10.256410 8.974359 14.102564 14.102564 7.692308 16.666667 24.358974 26.923077 17.948718 5.128205 10.256410 10.256410 12.820513 15.384615 2.564103 5.128205 8.974359 7.692308 16.666667 16.666667 7.692308 3.846154 16.666667 7.692308 0.000000 21.794872 8.974359 16.666667 26.923077 14.102564 12.820513 26.923077 26.923077 21.794872 21.794872 5.128205 17.948718 17.948718 11.538462 11.538462 14.102564 11.538462 11.538462 14.102564 20.512821 20.512821 24.358974 20.512821 20.512821 23.076923 5.128205 5.128205 7.692308 12.820513 12.820513 21.794872 28.205128 8.974359 16.666667 16.666667 24.358974 14.102564 3.846154

Based on the ecotopeArea assumed above and TEI, the potential taxonomic group flood plain importance score, TFI (PotTax in the paper), can be calculated as follows.

In [39]:
bsIO.show_full_data_frame(TFI)
The size/shape of data frame is (number of rows, columns): (7, 1)
Out[39]:
TFI
taxonomicGroup
Birds 17.501873
Butterflies 7.804878
DragonDamselflies 21.986568
Fish 14.675839
Herpetofauna 33.143631
HigherPlants 5.810357
Mammals 30.998541

The sum of TFI is reported as FI (PotAll in the paper), the potential floodplain importance score.

In [40]:
bsIO.show_full_data_frame(FI)
The size/shape of data frame is (number of rows, columns): (1, 1)
Out[40]:
FI
FI 131.921687

Based on the ecotopeArea assumed above and ATEI, the actual taxonomic group flood plain importance score, ATFI (ActTax in the paper), can be calculated as follows.

In [41]:
bsIO.show_full_data_frame(ATFI)
The size/shape of data frame is (number of rows, columns): (7, 1)
Out[41]:
ATFI
taxonomicGroup
Birds 9.460584
Butterflies 3.056911
DragonDamselflies 11.664899
Fish 10.068793
Herpetofauna 14.363144
HigherPlants 2.938317
Mammals 13.883677

The sum of ATFI is reported as the actual floodplain importance score, AFI (ActAll in the paper).

In [42]:
bsIO.show_full_data_frame(AFI)
The size/shape of data frame is (number of rows, columns): (1, 1)
Out[42]:
AFI
AFI 65.436326

Based on AFI and FI, we can calculated the floodplain importance saturation, FIS (SatAll in the paper), as follows.

In [43]:
bsIO.show_full_data_frame(FIS)
The size/shape of data frame is (number of rows, columns): (1, 1)
Out[43]:
FIS
FIS 49.602402

For each taxonomic group, the taxonomic group floodplain importance saturation, TFIS (SatTax in the paper), can be calculated based on ATFI and FIS. TFIS describes the fraction/saturation of actual over potential biodiversity.

In [44]:
bsIO.show_full_data_frame(TFIS)
The size/shape of data frame is (number of rows, columns): (7, 1)
Out[44]:
TFIS
Birds 54.054697
Butterflies 39.166667
DragonDamselflies 53.054662
Fish 68.607955
Herpetofauna 43.336059
HigherPlants 50.570342
Mammals 44.788164

Based on TEI and ecotopeArea, we can calculate TFHS (HabDiv in the paper), the taxonomic group floodplain habitat saturation, which describes the fraction of suitable ecotopes, weighed by law, for each taxonomic group.

In [45]:
bsIO.show_full_data_frame(TFHS)
The size/shape of data frame is (number of rows, columns): (7, 1)
Out[45]:
TFHS
taxonomicGroup
Birds 100.0
Butterflies 100.0
DragonDamselflies 100.0
Fish 100.0
Herpetofauna 100.0
HigherPlants 100.0
Mammals 100.0
In [46]:
# bsIO.show_full_data_frame(FTEI)
# FTEI is not found in the paper.
# FTEI: Floodplain Taxonomic group Ecotope Importance

Running the BIOSAFE in a spatial mode

In the following cells, we will demonstrate the BIOSAFE model in a spatial model. The BIOSAFE model will be fed by spatial data, particularly on ecotope distribution and species monitoring data.

We assume the following floodplain section map flpl_sections, which would be loaded and vizualized by executing the following notebook cells.

In [47]:
flpl_sections_f = os.path.join(output_folder, 'flpl_sections.map')
flpl_sections = pcr.readmap(flpl_sections_f)
In [48]:
plot(flpl_sections)
Out[48]:

The following ecotope map ecotopes would be assumed.

In [49]:
ecotopes = biosafe.read_map_with_legend(os.path.join(output_folder, 'ecotopes.map'))
In [50]:
#~ # plot the ecotope map (not needed)
#~ plot(ecotopes.pcr_map)

For the input related to species monitoring data, the following data frame of ndff_species is used (i.e. related to species presence and characteristics).

In [51]:
ndff_species = pd.read_pickle(os.path.join(output_folder, 'ndff_sub_BS_13.pkl'))
In [52]:
# Note: This cell is for visualizing data only and may be heavy.
# You may want to skip it or clear its output after executing it.
# ndff_species.shape
# bsIO.show_full_data_frame(ndff_species)

Given the inputs defined above, we can initiate the BIOSAFE model in a spatial model by running the following cell. Note that the inputs of speciesPresence and ecotopoArea are calculated based on the aformentioned inputs of ndff_species, ecotopes, and flpl_sections. For this example, we would calculate the scores FI and TFI.

In [53]:
bs_spatial = biosafe.spatialBiosafe(bs, ecotopes, flpl_sections, ndff_species,
                            params = ['FI', 'TFI'],
                            toFiles = None)
FI, TFI = bs_spatial.spatial()
Computing surface area sum of ecotopes from raster
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>

The calculated TFI values are given as follows, for each taxonomic group and for each floodplain section.

In [54]:
bsIO.show_full_data_frame(TFI)
The size/shape of data frame is (number of rows, columns): (52, 9)
Out[54]:
TFI Birds Butterflies DragonDamselflies Fish Herpetofauna HigherPlants Mammals xcoor ycoor
ID
107 16.144495 7.820225 13.141182 17.458946 30.973783 4.830239 25.352924 196712.5 436237.5
108 15.855753 3.312417 3.955888 6.577382 6.538518 3.867630 12.355960 195837.5 435862.5
109 16.649028 9.938450 7.222100 15.027019 20.025971 5.778082 16.433930 196912.5 435962.5
110 14.586531 8.735703 7.786215 15.177215 21.468315 7.720135 17.779627 197762.5 434737.5
111 16.234910 8.029038 4.771956 18.225604 20.512704 4.356087 27.284308 165462.5 434837.5
112 16.786008 8.747552 7.674404 12.885461 19.398326 4.785917 20.728542 161562.5 434137.5
114 13.198705 5.083638 9.749856 16.797002 16.977377 3.940638 22.405390 167737.5 434287.5
115 15.855868 7.689397 12.261925 19.449556 22.198620 4.542972 25.938538 166537.5 434012.5
116 15.545427 12.223645 17.250745 19.156886 26.967567 5.965274 28.112423 172012.5 433912.5
117 13.333041 5.310026 8.740360 33.014304 13.801200 3.784090 13.525806 178737.5 433362.5
118 15.873482 10.224012 8.646454 16.918946 18.341005 5.194627 17.639885 176637.5 433562.5
119 16.569393 7.624240 17.163090 12.866146 28.397537 6.451708 26.763940 200262.5 432612.5
120 16.571047 21.644743 11.519756 23.642552 27.253961 8.497099 24.402674 181587.5 432737.5
121 14.779136 5.208156 6.988682 19.321954 14.196302 3.829087 14.552407 159762.5 432787.5
122 15.068113 9.058191 14.182524 16.445364 27.134067 4.923395 26.274372 190387.5 432437.5
124 14.356826 6.980709 17.190395 27.351578 25.751458 4.489608 25.153282 179787.5 432562.5
125 15.688133 10.728569 13.802873 18.337762 27.353750 5.080621 26.166145 158062.5 430862.5
126 15.764490 8.831447 18.022137 17.989351 30.673664 5.461682 29.831505 183762.5 431287.5
127 15.430388 7.914243 9.152806 19.049599 22.327865 4.407554 19.739861 186087.5 430912.5
128 16.366727 13.545894 19.742876 17.233370 32.071256 6.857256 31.626254 189712.5 430037.5
129 10.519350 2.872818 3.361162 43.909457 8.270989 3.235119 12.603108 200437.5 431337.5
130 18.698196 31.238095 10.559006 21.245421 33.174603 12.111801 24.908425 200962.5 431112.5
131 17.199003 17.779205 12.388241 22.079086 25.854587 7.127155 23.408926 155112.5 427787.5
133 11.011387 4.781567 4.403927 32.020560 13.872504 4.939266 23.190358 185612.5 430087.5
134 15.845595 15.557676 11.675086 24.150442 23.107192 6.747418 20.625598 155337.5 426662.5
135 12.751637 7.592233 8.452230 36.728902 12.802589 4.555016 13.731641 136087.5 426212.5
136 9.419941 3.408547 10.724638 38.641245 15.980057 3.704478 16.905545 131362.5 425787.5
137 14.468784 9.364452 7.974397 30.750817 20.441652 4.398271 21.370897 152987.5 424387.5
138 15.370169 19.371907 11.254490 27.462888 22.873243 7.768954 24.815222 132737.5 425487.5
139 13.468643 10.607500 12.967391 40.166667 24.179167 5.139266 22.717949 130737.5 425837.5
140 13.341544 7.281037 9.076754 27.461783 14.682810 4.132715 18.613793 137012.5 424862.5
142 17.094028 10.809168 16.841528 7.026024 31.580393 6.464634 33.408612 130412.5 424487.5
143 18.959183 6.412514 13.481787 10.743679 28.426033 5.199569 41.295273 131487.5 423062.5
155 7.565415 0.000000 2.229654 66.732413 1.367521 0.209030 6.311637 200937.5 431412.5
156 16.691202 13.242957 14.807620 18.705586 27.758655 6.673609 26.153665 194987.5 430587.5
157 12.962999 6.154897 15.877653 30.508343 22.227284 5.220610 22.399393 198487.5 433062.5
158 13.889718 7.056466 14.137694 23.271527 29.982797 4.144145 29.074230 192437.5 431212.5
159 16.749533 15.586454 20.613510 16.034007 32.471495 7.041319 33.300634 197962.5 431887.5
160 15.815128 6.939608 10.672457 17.602309 23.463880 4.101709 24.514036 174387.5 434837.5
161 16.689400 8.060861 7.395274 16.600344 18.925277 4.795973 16.893501 169162.5 435237.5
162 15.057960 9.207101 6.071520 25.920194 18.185404 4.783895 20.898953 159637.5 433537.5
163 13.893564 8.456993 14.302435 31.382056 23.547822 5.261176 23.651868 157337.5 431362.5
164 12.817334 10.752490 7.689489 40.697514 16.592593 5.382934 15.527066 152387.5 423637.5
165 12.804950 9.499213 9.291339 32.638805 22.018373 5.502610 23.066828 146312.5 425337.5
166 17.693822 10.080831 13.446697 14.877837 26.772668 5.292802 25.942169 148787.5 425137.5
167 19.594611 29.741015 16.200232 15.968428 36.005732 10.603387 31.744604 151487.5 425612.5
168 19.577528 32.742515 20.798750 15.984646 40.652295 11.401718 36.481499 146912.5 426312.5
169 15.682427 14.432274 13.378335 19.825089 24.148329 6.795206 27.186070 143712.5 425312.5
170 14.510087 7.827429 22.015159 37.597244 20.377645 4.222965 19.480794 142362.5 424312.5
171 13.787495 8.317889 19.249063 30.003630 28.325826 4.373968 24.910487 139837.5 424962.5
195 12.302788 3.785377 7.065217 36.993529 13.571148 2.879377 13.642205 137937.5 425412.5
196 15.114679 5.662211 11.547813 18.932163 27.917530 3.222547 27.814550 141587.5 425687.5

Then, for each flood plain section, the calculated FI value is given as follows.

In [55]:
bsIO.show_full_data_frame(FI)
The size/shape of data frame is (number of rows, columns): (52, 3)
Out[55]:
FI FI xcoor ycoor
ID
107 115.721794 196712.5 436237.5
108 52.463548 195837.5 435862.5
109 91.074579 196912.5 435962.5
110 93.253743 197762.5 434737.5
111 99.414607 165462.5 434837.5
112 91.006210 161562.5 434137.5
114 88.152606 167737.5 434287.5
115 107.936875 166537.5 434012.5
116 125.221968 172012.5 433912.5
117 91.508825 178737.5 433362.5
118 92.838410 176637.5 433562.5
119 115.836053 200262.5 432612.5
120 133.531832 181587.5 432737.5
121 78.875722 159762.5 432787.5
122 113.086025 190387.5 432437.5
124 121.273857 179787.5 432562.5
125 117.157853 158062.5 430862.5
126 126.574277 183762.5 431287.5
127 98.022317 186087.5 430912.5
128 137.443633 189712.5 430037.5
129 84.772003 200437.5 431337.5
130 151.935548 200962.5 431112.5
131 125.836202 155112.5 427787.5
133 94.219569 185612.5 430087.5
134 117.709007 155337.5 426662.5
135 96.614249 136087.5 426212.5
136 98.784450 131362.5 425787.5
137 108.769270 152987.5 424387.5
138 128.916872 132737.5 425487.5
139 129.246583 130737.5 425837.5
140 94.590436 137012.5 424862.5
142 123.224387 130412.5 424487.5
143 124.518039 131487.5 423062.5
155 84.415671 200937.5 431412.5
156 124.033294 194987.5 430587.5
157 115.351179 198487.5 433062.5
158 121.556578 192437.5 431212.5
159 141.796952 197962.5 431887.5
160 103.109127 174387.5 434837.5
161 89.360629 169162.5 435237.5
162 100.125028 159637.5 433537.5
163 120.495915 157337.5 431362.5
164 109.459419 152387.5 423637.5
165 114.822117 146312.5 425337.5
166 114.106827 148787.5 425137.5
167 159.858009 151487.5 425612.5
168 177.638951 146912.5 426312.5
169 121.447730 143712.5 425312.5
170 126.031324 142362.5 424312.5
171 128.968359 139837.5 424962.5
195 90.239642 137937.5 425412.5
196 110.211493 141587.5 425687.5

Assessing biodiversity change, before and after measure

The exercise in the following cells is an exercise to access such a floodplain measure to biodiversity change.

We assume such a measure is implemented in the following ecotope map msr_eco.

In [56]:
msr_eco = biosafe.read_map_with_legend(os.path.join(output_folder, 'ecotopes_msr.map'))
In [57]:
#~ # plot the ecotope map (not needed)
#~ plot(msr_eco.pcr_map)

Note that this measure is only implemented in some parts of the model area (not for all floodplain IDs). Its reference/existing condition (before the measure), which is taken from them map ecotopes map, is given as ref_eco.

In [58]:
msr_area = pcr.defined(msr_eco.pcr_map)
sections = pcr.ifthen(msr_area, pcr.nominal(1))
ref_eco = biosafe.LegendMap(pcr.ifthen(msr_area, ecotopes.pcr_map), msr_eco.legend_df)
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>

The flood plain sections where the measure is implemented are illustrated below. We will evaluate biodiversity change within this area.

In [59]:
plot(sections)
Out[59]:
In [60]:
#~ # plot the ecotope map (not needed)
#~ plot(ref_eco.pcr_map)

Biodiversity before the measure

The BIOSAFE model for the reference/existing condition is calculated as follows. For this exercise, we just calculate the scores FI and TFI (with the subscript ref indicating the reference condition, before the measure).

In [61]:
bs_ref = biosafe.spatialBiosafe(bs, ref_eco, sections, ndff_species,
                        params = ['FI', 'TFI'], toFiles = None)
FI_ref, TFI_ref = bs_ref.spatial()
Computing surface area sum of ecotopes from raster
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>

Biodiversity after the measure

The BIOSAFE model for the measure condition is calculated as follows. We also calculate the scores FI and TFI (with the subscript msr indicating the condition after the measure).

In [62]:
bs_msr = biosafe.spatialBiosafe(bs, msr_eco, sections, ndff_species,
                        params = ['FI', 'TFI'], toFiles = None)
FI_msr, TFI_msr = bs_msr.spatial()
Computing surface area sum of ecotopes from raster
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>
<class 'pcraster._pcraster.Field'>

Evaluating biodiversity change

After implemeting the BIOSAFE model for the before and after measures, bs_ref and bs_msr, we can compare their scores.

We can compare and plot the TFI scores, before and after the measure.

In [63]:
#%% activating matplotlib visualization
%matplotlib notebook
In [64]:
sns.set_style("ticks")
# TFI_ref.drop(['xcoor', 'ycoor'], axis=1).plot.bar()
# TFI_msr.drop(['xcoor', 'ycoor'], axis=1).plot.bar()

comparison = pd.concat([TFI_ref, TFI_msr]).drop(['xcoor', 'ycoor'], axis=1)
comparison.index = ['Reference', 'Measures']
comparison.columns = [u'Birds', u'Butterflies', u'Dragon- and damselflies',
                    u'Fish', u'Herpetofauna', u'Higher plants', u'Mammals']
comparison.columns.name = 'Taxonomic group'

comparison.plot.bar(rot=0)


plt.savefig('comparison_biosafe_TFI.png', dpi=300)
comparison.to_csv('comparison_biosafe_TFI.csv')
Out[64]:
<matplotlib.axes._subplots.AxesSubplot at 0x2ad20856e460>

We can also compare and plot the FI scores, before and after the measure, by running the following cells.

In [65]:
sns.set_style("ticks")
# FI_ref.drop(['xcoor', 'ycoor'], axis=1).plot.bar()
# FI_msr.drop(['xcoor', 'ycoor'], axis=1).plot.bar()

comparison = pd.concat([FI_ref, FI_msr]).drop(['xcoor', 'ycoor'], axis=1)
comparison.index = ['Reference', 'Measures']
comparison.plot.bar(rot=0)

plt.savefig('comparison_biosafe_FI.png', dpi=300)
comparison.to_csv('comparison_biosafe_FI.csv')
Out[65]:
<matplotlib.axes._subplots.AxesSubplot at 0x2ad214239f70>
In [ ]: